package cn.supermaster.management.web.rest.monitor;

import cn.supermaster.management.common.annotation.Log;
import cn.supermaster.management.common.enums.BusinessType;
import cn.supermaster.management.common.page.TableDataInfo;
import cn.supermaster.management.common.response.WebResponse;
import cn.supermaster.management.system.domain.SystemOperateLog;
import cn.supermaster.management.web.service.monitor.IMonitorOperateLogService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName: supermaster-management
 * @Package: cn.supermaster.management.web.rest.monitor
 * @ClassName: MonitorOperateLogRestController
 * @Description: []
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2021/1/10 19:50
 * @Version: V1.0
 * @Copyright: 2021 www.super-bytecode.comn Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
@RestController
@RequestMapping("/monitor/operlog")
public class MonitorOperateLogRestController {

    @Autowired
    private IMonitorOperateLogService monitorOperateLogService;

    @RequiresPermissions("monitor:operlog:list")
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public TableDataInfo queryOperateLogList(SystemOperateLog operLog) {
        return monitorOperateLogService.queryOperateLogList(operLog);
    }

    @Log(title = "操作日志", businessType = BusinessType.EXPORT)
    @RequiresPermissions("monitor:operlog:export")
    @RequestMapping(value = "/export", method = RequestMethod.POST)
    public WebResponse doExportOperateLog(SystemOperateLog operLog) {
        return monitorOperateLogService.doExportOperateLog(operLog);
    }

    @RequiresPermissions("monitor:operlog:remove")
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    public WebResponse doRemoveOperateLog(String ids) {
        return monitorOperateLogService.doRemoveOperateLog(ids);
    }

    @Log(title = "操作日志", businessType = BusinessType.CLEAN)
    @RequiresPermissions("monitor:operlog:remove")
    @RequestMapping(value = "/clean", method = RequestMethod.POST)
    public WebResponse clean() {
        return monitorOperateLogService.doCleanOperateLog();
    }

}